package ru.tatintec.gwttest.server.dao;

import java.util.ArrayList;
import java.util.Date;
import ru.tatintec.gwttest.shared.Employee;
import ru.tatintec.gwttest.shared.Employee.Sex;

/**
 * Singleton ArrayList<Employee>()
 *
 * this is a stub
 *  //TODO represent it as DAO 
 */

public class EmployeeCatalog {
	
	// domain stub 
	private static final ArrayList<Employee> list = new ArrayList<Employee>();
	
	public static ArrayList<Employee> INSTANCE() {
		
		// for testing
//		if (list.size() == 0) {
//			generateTestData();
//		}
		return list;
	}
	
	public static void generateTestData() {
		for (int i = 0; i<50; i++) {
			Employee e = Employee.create("Firstname"+i, "Lastname"+i, "Middlename"+i, Sex.MALE, new Date(), new Date());
			e.setId(""+(System.currentTimeMillis()+i));
			list.add(e);
		}
	}

}
